package delphorm.dao.tests;

import java.util.Properties;

import junit.framework.TestCase;

import org.springframework.jdbc.datasource.DriverManagerDataSource;
import org.springframework.orm.hibernate3.LocalSessionFactoryBean;

public class MappingTest extends TestCase {
	LocalSessionFactoryBean sessionFactory;
	DriverManagerDataSource datasource;
	

	public void setUp() throws Exception {
		super.setUp();
		datasource = new DriverManagerDataSource();
		datasource.setDriverClassName("org.postgresql.Driver");
		datasource.setUsername("admin");
		datasource.setPassword("admin");
		datasource.setUrl("jdbc:postgresql://localhost:5432/autoformdb");
		
		sessionFactory = new LocalSessionFactoryBean();
		sessionFactory.setDataSource(datasource);
		String[] fichiersmapping = new String[]{
			"mapping/utilisateur.hbm.xml",
	        "mapping/groupe.hbm.xml",
	        "mapping/droitgroupe.hbm.xml",
	        "mapping/question.hbm.xml",
	        "mapping/questionnaire.hbm.xml",
	        "mapping/reponse.hbm.xml",
	        "mapping/reponseOuverte.hbm.xml",
	        "mapping/reponseFermee.hbm.xml",
	        "mapping/valeur.hbm.xml",
	        "mapping/valeurTexte.hbm.xml",
	        "mapping/valeurNumerique.hbm.xml",
	        "mapping/valeurFichier.hbm.xml",
	        "mapping/instanceQuestionnaire.hbm.xml",
	        "mapping/instanceQuestion.hbm.xml",
	        "mapping/instanceReponse.hbm.xml",
	        "mapping/instanceReponseOuverte.hbm.xml",
	        "mapping/instanceReponseFermee.hbm.xml",
	        "mapping/filtre.hbm.xml",
	        "mapping/filtreNumerique.hbm.xml",
	        "mapping/filtreTexte.hbm.xml"
		};
		sessionFactory.setMappingResources(fichiersmapping);
		Properties prop = new Properties();
		prop.put("hibernate.dialect","org.hibernate.dialect.PostgreSQLDialect");
		prop.put("current_session_context_class","thread");
		prop.put("show_sql","true");
		sessionFactory.setHibernateProperties(prop);
		
	}
	
	public void testAaaaaa()
	{
		
		int a = 1;
	}

}
